home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Education
/
World of Education.iso
/
world_t
/
tipsamp1.zip
/
TIPS-058.ASC
< prev
next >
Wrap
Text File
|
1992-08-23
|
2KB
|
47 lines
TIP #: 058
KEYWORDS: Network, DESQview, Concurrent Access
UPDATED: August, 1992
PROBLEM: How can two network or DESQview users be prevented from accessing a
non-network application at the same time?
SYMPTOMS: When two users are allowed to access the same program, files can
get corrupted. Also, some of the programs may not be network
aware, and should not be shared among many simultaneous users.
SOLUTION: The solution to this problem is to set up a batch file for each
application, using token files to prevent simultaneous access. A
sample batch file would look like this:
:START
IF EXIST PROGRAM.TOK GOTO BUSY
REM > PROGRAM.TOK
PROGRAM
ERASE PROGRAM.TOK
GOTO EXIT
:BUSY
ECHO Sorry, this program is in use. Try again later.
PAUSE
:EXIT
This batch file checks for the existence of the file "PROGRAM.TOK".
If this file exists, it means that another user is currently using
the program. The batch file then displays a message that the
program is in use and then exits. If the program is not currently
in use, the batch file creates the file "PROGRAM.TOK" so that other
users will not have access. It then runs your program, erasing the
token file when it exits. If your program runs from its own batch
file, you should substitute the line "CALL PROGRAM" for "PROGRAM"
in the above example. Note that you must leave off the .BAT
extension when you call another batch file. You should substitute
your file names for "PROGRAM" in the above example. By using token
files, programs which were never intended to be used on a network
can be safely accessed. This technique can also be used from
withing DESQview to prevent multiple access to programs. I use
token files to prevent simultaneous access to single-user doors on
my BBS, which runs under DESQview.